<%--
  Created by IntelliJ IDEA.
  User: 刘琛
  Date: 2020/11/21
  Time: 19:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%pageContext.setAttribute("APP_PATH", request.getContextPath());%>

<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta charset="utf-8" />
    <meta name="description" content="Static &amp; Dynamic Tables" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
    <link rel="stylesheet" href="${APP_PATH }/assets/css/bootstrap.min.css" />
    <link rel="stylesheet" href="${APP_PATH }/assets/font-awesome/4.5.0/css/font-awesome.min.css" />
    <link rel="stylesheet" href="${APP_PATH}/recourse/css/font.css">
    <link rel="stylesheet" href="${APP_PATH}/recourse/css/login.css">
    <link rel="stylesheet" href="${APP_PATH}/recourse/css/xadmin.css">

    <link rel="stylesheet" href="${APP_PATH }/assets/css/fonts.googleapis.com.css" />

    <link rel="stylesheet" href="${APP_PATH }/assets/css/ace.min.css" class="ace-main-stylesheet" id="main-ace-style" />

    <link rel="stylesheet" href="${APP_PATH }/assets/css/ace-skins.min.css" />
    <link rel="stylesheet" href="${APP_PATH }/assets/css/ace-rtl.min.css" />

    <script src="${APP_PATH }/assets/js/ace-extra.min.js"></script>
    <script src="${APP_PATH }/recourse/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${APP_PATH }/assets/js/xadmin.js"></script>
    <title>维修单流程表</title>

</head>
<style type="text/css">
    h2{
        margin:0 auto;
        text-align: center;
    }
    table{
        border-collapse:collapse;
        text-align: center;
        margin: 0 auto;
    }
    table span{
        display: inline-block;
        width: 100px;
        text-align: right;
    }
    body{font-size: 18px;}
    td {font-size: 18px;}
    #time span{
        width: 30px;
    }
</style>
<body>
<div id="div_print" style="background-color: white;">
    <h2>维修单流程表</h2>

    <p style="text-align: center">打印人员：${user.name}
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <jsp:useBean id="time" class="java.util.Date">
        打印时间：<fmt:formatDate value="<%=time%>" type="both" pattern="yyyy-MM-dd HH:mm:ss"/>

        <a  onclick="printProcess()">
            <i class="layui-icon layui-icon-print" style="font-size: 25px"></i>
        </a>
    </p>
    <table border="1" style="width:750px;height: 35px">
        <tr>
            <td style="width: 20%;" align="center">维修单名称</td>
            <td style="width: 30%;"> ${order.order_name}</td>
            <td style="width: 20%;" align="center">维修单状态</td>
            <td style="width: 30%;">
            ${order.order_state == 8 || order.order_state == 9 || order.order_state == 10?'已完成':order.order_state == 11 || order.order_state == 15?'异常结束':'未完成'}
            </td>

        </tr>
    </table>

    <table border="1" style="width: 750px; border-top: 0px;">
        <tr>
            <td rowspan="4" style="width: 20%;">报修信息</td>
            <td style="width:15%; ">报修设备</td>
            <td style="width: 25%; ">${order.equipment_name}</td>
            <td style="width: 15%;">报修时间</td>
            <td style="width: 25%;">
                <fmt:formatDate value="${order.createTime}" type="both" pattern="yyyy-MM-dd HH:mm:ss"/>
            </td>
        </tr>
        <tr>
            <td style="width: 15%; ">报修人</td>
            <td style="width: 25%; ">${order.equipment_admin_name}</td>
            <td style="width: 15%; ">报修单位</td>
            <td style="width: 25%; ">${order.insiderUnit_name}</td>
        </tr>
        <tr>
            <td style="width: 15%; ">维修地点</td>
            <td colspan="3" style="width: 65%; ">${order.maintenance_location==""?"暂无":order.maintenance_location}</td>
        </tr>
        <tr>
            <td style="width: 15%; ">问题描述</td>
            <td colspan="3" style="width: 65%;">
                <c:if test="${order.problem_word.equals('')}">
                    无
                </c:if>
                    ${order.problem_word}
            </td>
        </tr>
    </table>
    <table border="1" style="width: 750px; border-top: 0px;">
        <tr>
            <td style="width: 20%;">报修人维修要求</td>
            <td style="width: 80%; ">
                <c:if test="${equipment_adminRequest.size() == 0}">
                    无
                </c:if>
                <c:forEach items="${equipment_adminRequest}" var="equipment_adminRequest">
                ${equipment_adminRequest.user_name}:&nbsp;&nbsp;&nbsp;${equipment_adminRequest.maintenance_request}&nbsp;&nbsp;&nbsp;<fmt:formatDate value="${equipment_adminRequest.create_time}" type="both" pattern="yyyy-MM-dd HH:mm:ss"/>&nbsp;&nbsp;&nbsp;
            </c:forEach></td>
        </tr>
    </table>
    <table border="1" style="width: 750px; border-top: 0px;">
        <tr>
            <td rowspan="2" style="width: 20%; ">报修审核信息</td>
            <td style="width: 40%; ">拟定价格</td>
            <td style="width: 40%; ">${order.second_price}&nbsp;元</td>
        </tr>
        <tr>
            <td colspan="2" style="width: 80%;"><c:forEach items="${process}" var="process">
                <c:if test="${process.task_id == 2}">
                    ${process.detail}&nbsp;&nbsp;&nbsp;<fmt:formatDate value="${process.finished_time}" type="both" pattern="yyyy-MM-dd HH:mm:ss"/>&nbsp;&nbsp;&nbsp;<c:if test="${process.reason != null && process.reason != ''}">理由为：${process.reason}</c:if><br/>
                </c:if>
            </c:forEach></td>
        </tr>
    </table>
    <table border="1" style="width: 750px; border-top: 0px;">

        <tr>
            <td style="width: 20%; ">审核员维修要求</td>
            <td style="width: 80%; ">
                <c:if test="${approverRequest.size() == 0}">
                    无
                </c:if>
                <c:forEach items="${approverRequest}" var="approverRequest">
                    ${approverRequest.user_name}:&nbsp;&nbsp;&nbsp;${approverRequest.maintenance_request}&nbsp;&nbsp;&nbsp;<fmt:formatDate value="${approverRequest.create_time}" type="both" pattern="yyyy-MM-dd"/>&nbsp;&nbsp;&nbsp;<br/>
                </c:forEach></td>
        </tr>

        <tr>
            <td style="width: 20%; ">审批员审批意见</td>
            <td style="width: 80%; ">
                <c:if test="${first_reviewerAdvice.size() == 0}">
                    无
                </c:if>
                <c:forEach items="${first_reviewerAdvice}" var="first_reviewerAdvice">
                    ${first_reviewerAdvice.detail}&nbsp;&nbsp;&nbsp;
                    <fmt:formatDate value="${first_reviewerAdvice.finished_time}" type="both" pattern="yyyy-MM-dd HH:mm:ss"/>&nbsp;&nbsp;&nbsp;
                    <c:if test="${first_reviewerAdvice.reason != null && first_reviewerAdvice.reason != ''}">理由为：${first_reviewerAdvice.reason}</c:if><br/>
            </c:forEach></td>
        </tr>
    </table>
    <table border="1" style="width: 750px; border-top: 0px;">
        <tr>
            <c:if test="${expense_details.size() != 0}">
                <td rowspan="4" style="width: 20%; ">维修反馈</td>
            </c:if>
            <c:if test="${expense_details.size() == 0}">
                <td rowspan="3" style="width: 20%; ">维修反馈</td>
            </c:if>
            <td style="width: 15%; ">维修方</td>
            <td style="width: 25%; ">

                    ${order.unit_name}
            </td>
            <td style="width: 15%; ">维修价格</td>
            <td style="width: 25%; ">${order.final_price}&nbsp;元</td>
        </tr>
        <tr>
            <td style="width: 15%; ">维修完成时间</td>
            <td colspan="3" style="width: 65%; ">
                    ${finishTIme}
            </td>
        </tr>
        <tr>
            <td  style="width: 15%; ">维修方案描述</td>
            <td colspan="3" style="width: 65%; ">${order.solution_word}</td>
        </tr>
        <c:if test="${expense_details.size() != 0}">
            <tr>
                <td  style="width: 15%; ">维修清单</td>

                <td colspan="3" style="width: 65%; "><c:forEach items="${expense_details}" var="expense_detail">
                    耗材名称：${expense_detail.consumable_name}&nbsp;&nbsp;耗材数量：${expense_detail.consumable_num}&nbsp;&nbsp;耗材单价：${expense_detail.consumable_price}<c:if test="${expense_detail.classifier != ''}">/${expense_detail.classifier}</c:if><br/>
                </c:forEach></td>
            </tr>
        </c:if>
    </table>
    <table border="1" style="width: 750px; border-top: 0px;">
        <tr>
            <td style="width: 20%; ">报修人验收</td>
            <td style="width: 80%; "><c:forEach items="${process}" var="equipment_adminProcess">
                <c:choose>
                    <c:when test="${equipment_adminProcess.task_id == 6}">
                    ${equipment_adminProcess.detail}&nbsp;&nbsp;&nbsp;<fmt:formatDate value="${equipment_adminProcess.finished_time}" type="both" pattern="yyyy-MM-dd HH:mm:ss"/>&nbsp;&nbsp;&nbsp;<c:if test="${equipment_adminProcess.reason != null && equipment_adminProcess.reason != ''}">理由为：${equipment_adminProcess.reason}</c:if><br/>
                    </c:when>
                    <c:otherwise>

                    </c:otherwise>
                </c:choose>
            </c:forEach> </td>
        </tr>
        <tr>
            <td style="width: 20%; ">审核员验收</td>
            <td style="width: 80%; "><c:forEach items="${process}" var="approverProcess">
                <c:if test="${approverProcess.task_id == 7}">
                    ${approverProcess.detail}&nbsp;&nbsp;&nbsp;<fmt:formatDate value="${approverProcess.finished_time}" type="both" pattern="yyyy-MM-dd HH:mm:ss"/>&nbsp;&nbsp;&nbsp;<c:if test="${approverProcess.reason != null && approverProcess.reason != ''}">理由为：${approverProcess.reason}</c:if><br/>
                </c:if>

            </c:forEach> </td>
        </tr>
<%--        <tr>--%>
<%--            <td style="width: 20%; height: 10vh">处长审批意见</td>--%>
<%--            <td style="width: 80%; height: 10vh">--%>
<%--                <c:if test="${first_reviewerAcceptAdvice.size() == 0}">--%>
<%--                    无--%>
<%--                </c:if>--%>
<%--                <c:forEach items="${first_reviewerAcceptAdvice}" var="first_reviewerAcceptAdvice">--%>
<%--                ${first_reviewerAcceptAdvice.detail}&nbsp;&nbsp;&nbsp;<fmt:formatDate value="${first_reviewerAcceptAdvice.finished_time}" type="both" pattern="yyyy-MM-dd HH:mm:ss"/>&nbsp;&nbsp;&nbsp;<c:if test="${first_reviewerAcceptAdvice.reason != null && first_reviewerAcceptAdvice.reason != ''}">理由为：${first_reviewerAcceptAdvice.reason}</c:if><br/>--%>
<%--            </c:forEach></td>--%>
<%--        </tr>--%>

    </table>
    <table border="1" style="width: 750px; border-top: 0px;">
        <tr>
            <td style="width: 20%; ">报修人评价</td>
            <td style="width: 80%; "><c:forEach items="${process}" var="process">
                <c:if test="${process.task_id == 9}">
                    ${process.detail}&nbsp;&nbsp;&nbsp;<fmt:formatDate value="${process.finished_time}" type="both" pattern="yyyy-MM-dd HH:mm:ss"/><br/>
                </c:if>
            </c:forEach></td>
        </tr>
    </table>

    <table border="1" style="width: 750px;border-top: 0px;">
        <tr>
            <td style="width: 20%; height: 5vh">备注</td>
            <td style="width: 80%; height: 5vh"></td>
        </tr>
    </table>
<%--    <c:if test="${addEvaluation.size() > 0}">--%>
<%--        <br/>--%>
<%--        <br/>--%>
<%--        <br/>--%>
<%--        <br/>--%>
<%--        <table border="1" style="width: 600px;height: 35px; font-size: small">--%>
<%--            <tr>--%>
<%--                <td style="width: 20%; height: 8vh">报修人追评</td>--%>
<%--                <td style="width: 80%; height: 8vh"><c:forEach items="${addEvaluation}" var="addEvaluation">--%>
<%--                    ${addEvaluation.detail}&nbsp;&nbsp;&nbsp;<fmt:formatDate value="${addEvaluation.finished_time}" type="both" pattern="yyyy-MM-dd HH:mm:ss"/><br/>--%>
<%--                </c:forEach></td>--%>
<%--            </tr>--%>
<%--        </table>--%>
<%--    </c:if>--%>

</div>
<div style="background-color: white;">
    <br>

    <a type="button"  target="_blank"  role="button" class="green" data-toggle="modal" href="${pageContext.request.contextPath}/admin/pricture?id=${order.id}" style="margin-left: 250px;size: 20px;">附件1-点击查看图片</a><br>
    <a type="button"  target="_blank"  role="button" class="green" data-toggle="modal" href="${pageContext.request.contextPath}/admin/download?filenames=${order.expense_file}" style="margin-left: 250px;size: 20px;">附件2-点击下载清单文件</a>

</div>

</jsp:useBean>
<script language="javascript">
    function printdiv(printpage)
    {
        var newstr = printpage.innerHTML;
        var oldstr = document.body.innerHTML;
        document.body.innerHTML =newstr;
        javascript:window.print();
        document.body.innerHTML=oldstr;
        return false;
    }
    function printProcess(){
        var div_print=document.getElementById("div_print");
        printdiv(div_print);
    }
</script>
</body>
</html>
